<template>
  <div class="layout">
    <!-- 导航栏 -->
    <nav class="navbar">
      <div class="logo">Vue商城</div>
      <div class="nav-links">
        <router-link 
          :to="{ name: 'Home' }" 
          :class="{ active: $route.name === 'Home' }"
        >
          首页
        </router-link>
        <router-link 
          :to="{ name: 'ProductList' }" 
          :class="{ active: $route.name === 'ProductList' }"
        >
          产品列表
        </router-link>
        <router-link 
          :to="{ name: 'Contact' }" 
          :class="{ active: $route.name === 'Contact' }"
        >
          平台介绍
        </router-link>
      </div>
    </nav>

    <!-- 页面内容 -->
    <router-view />
  </div>
</template>

<style scoped>
.layout {
  min-height: 100vh;
}
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #4a6fa5, #6a4a9e);
  color: white;
  padding: 0 20px;
  height: 60px;
}
.logo {
  font-size: 20px;
  font-weight: bold;
}
.nav-links {
  display: flex;
  gap: 20px;
}
.nav-links a {
  color: white;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background 0.3s;
}
.nav-links a.active,
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.2);
}
</style>